if (isset($_POST['retail'], $_POST['cost'])and $_POST['retail'] != '') {
  $retail = $_POST['retail'];
  $cost =  $_POST['cost'];
    // add sanitation here for post values.
    //test--echo "This var is set so I will print.";
?>

<div class="span6">
<h3>Example Page</h3>
<p>Totals</p>
<p>
<?php echo percentOf($retail, $cost);?><br />
<a href="index.php?page=example">Try Again</a> <!---notice how it is passed through the indexer-->
</p>
</div>

<?php
}
else
{

echo <<<EOT              //our view
<div class="span6">
<h3>Example Page</h3>
 <p>Enter Totals</p>
 <p>
 <form action="index.php?page=example" method="post">
 <input type="text" name="retail" id="retail" placeholder="Retail"><br />
 <input type="text" name="cost" id="cost"placeholder="Cost"><br />
 <input type="submit" id="submit">
 </form>
 </p>
 </div>
EOT;
 }
 ?>